package cn.scaucmi.maikejian.comprehensive;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

import java.io.IOException;

import cn.edu.scau.cmi.maikejian.client.*;
public class ComprehensiveController {

	 @FXML
	    private Button SingletonClient;

	    @FXML
	    private Button abstractFactoryUI;

	    @FXML
	    private ImageView imageview;

	    @FXML
	    private Button compositeClient;

	    @FXML
	    private Button safeClient;

	    @FXML
	    private Button SimpleFactoryUI;

	    @FXML
	    private Button FactoryUI;

	    @FXML
	    private Button adapterclient;
	    public void initialize() {
	    	imageview.setImage(new Image("/cn/scaucmi/maikejian/comprehensive/image.jpg"));
	   
	    }

    @FXML
    void Singletonclient(ActionEvent event) throws IOException {
    	Stage stage = new Stage();
    	Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/maikejian/Singleton/MyFxml.fxml"));
        Scene scene = new Scene(root, 500, 400);
        stage.initStyle(StageStyle.DECORATED);
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    void SimpleFactory(ActionEvent event) throws IOException {
    	Stage stage = new Stage();
    	Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/maikejian/simpleFactoryMethod/simpleFactoryUI.fxml"));
        Scene scene = new Scene(root, 500, 400);
        stage.initStyle(StageStyle.DECORATED);
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    void Factory(ActionEvent event) throws IOException {
    	Stage stage = new Stage();
    	Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/maikejian/factory/FactoryUI.fxml"));
        Scene scene = new Scene(root, 500, 400);
        stage.initStyle(StageStyle.DECORATED);
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    void abstractFactory(ActionEvent event) throws IOException {
    	Stage stage = new Stage();
    	Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/maikejian/abstractFactory/factory/abstractFactoryUI.fxml"));
        Scene scene = new Scene(root, 500, 400);
      
        stage.initStyle(StageStyle.DECORATED);
        
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    void Adapterclient(ActionEvent event) {
               new AdapterClient();
    }

    @FXML
    void safeclient(ActionEvent event) throws IOException {
    	Stage stage = new Stage();
    	Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/maikejian/composite/safe/consistentUI.fxml"));
        Scene scene = new Scene(root, 610, 610);
      
        stage.initStyle(StageStyle.DECORATED);
        
        stage.setScene(scene);
        stage.show();
    }

    @FXML
    void compositeclient(ActionEvent event) throws IOException {
    	Stage stage = new Stage();
    	Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/maikejian/composite/consistent/consistentUI.fxml"));
        Scene scene = new Scene(root, 610, 610);
      
        stage.initStyle(StageStyle.DECORATED);
        
        stage.setScene(scene);
        stage.show();
    }

}